package com.tuanbiao.utils;

import com.abiao.lib_utils.SPUtils;
import com.tuanbiao.constants.SPConstants;

/**
 * @author abiao
 * @since 2022/3/30 16:47
 */
public class SPHelper {
    public static boolean showSettingControlPanel() {
        return SPUtils.getInstance().getBoolean(SPConstants.SP_KEY_SHOW_SETTING_CONTROL_PANEL, false);
    }

    public static void setSettingControlPanel(boolean show) {
        SPUtils.getInstance().put(SPConstants.SP_KEY_SHOW_SETTING_CONTROL_PANEL, show);
    }

    public static boolean showSettingWorkModel() {
        return SPUtils.getInstance().getBoolean(SPConstants.SP_KEY_SHOW_SETTING_WORK_MODEL, false);
    }

    public static void setSettingWorkModel(boolean show) {
        SPUtils.getInstance().put(SPConstants.SP_KEY_SHOW_SETTING_WORK_MODEL, show);
    }

    public static boolean showSettingServerChange() {
        return SPUtils.getInstance().getBoolean(SPConstants.SP_KEY_SHOW_SETTING_SERVER_CHANGE);
    }

    public static void setSettingServerVisibility(boolean show) {
        SPUtils.getInstance().put(SPConstants.SP_KEY_SHOW_SETTING_SERVER_CHANGE,show);
    }

    public static boolean showSettingLocalChange() {
        return SPUtils.getInstance().getBoolean(SPConstants.SP_KEY_SHOW_SETTING_LOCAL_CHANGE);
    }

    public static void setSettingLocalVisibility(boolean show) {
        SPUtils.getInstance().put(SPConstants.SP_KEY_SHOW_SETTING_LOCAL_CHANGE,show);
    }

    public static boolean showDeviceNumChange() {
        return SPUtils.getInstance().getBoolean(SPConstants.SP_KEY_DEVICE_NUM_CHANGE);
    }

    public static void setDeviceNumVisibility(boolean show) {
        SPUtils.getInstance().put(SPConstants.SP_KEY_DEVICE_NUM_CHANGE,show);
    }
    public static void setCurrentLocation(double latitude, double longitude) {
//        SPUtils.getInstance().put(SPConstants.SP_KEY_CURRENT_LOCATION_LATITUDE,latitude);
//        SPUtils.getInstance().put(SPConstants.SP_KEY_CURRENT_LOCATION_LONGITUDE,longitude);
    }

    public static String userName() {
        return SPUtils.getInstance().getString(SPConstants.SP_KEY_USER_NAME);
    }

    public static void setUserName(String name) {
        SPUtils.getInstance().put(SPConstants.SP_KEY_USER_NAME, name);
    }

    public static void setProjectCompanyCode(String code) {
        SPUtils.getInstance().put(SPConstants.SP_KEY_PROJECT_COMPANY_CODE, code);
    }

    public static String getProjectCompanyCode() {
        return SPUtils.getInstance().getString(SPConstants.SP_KEY_PROJECT_COMPANY_CODE);
    }

    public static void setProjectBusinessType(boolean isBusiness) {
        SPUtils.getInstance().put(SPConstants.SP_KEY_PROJECT_IS_NATURE_BUSINESS, isBusiness);
    }

    public static boolean isProjectBusinessType() {
        return SPUtils.getInstance().getBoolean(SPConstants.SP_KEY_PROJECT_IS_NATURE_BUSINESS);
    }

    public static boolean isLoginValid() {
        return SPUtils.getInstance().getBoolean(SPConstants.SP_KEY_LOGIN_VALID);
    }

    public static void setLoginValid(boolean valid) {
        SPUtils.getInstance().put(SPConstants.SP_KEY_LOGIN_VALID,valid);
    }

    public static void setCodeMode(String codeMode) {
        SPUtils.getInstance().put(SPConstants.SP_KEY_CODE_MODEL,codeMode);
    }

    public static String getCodeMode() {
        return SPUtils.getInstance().getString(SPConstants.SP_KEY_CODE_MODEL);
    }

    public static boolean isFirst() {
        return SPUtils.getInstance().getBoolean(SPConstants.SP_KEY_FIRST_ENTER,true);
    }
    public static void setFirst(boolean first) {
        SPUtils.getInstance().put(SPConstants.SP_KEY_FIRST_ENTER,first);
    }

    public static void clearCommit(){
        SPUtils.getInstance().put(SPConstants.SP_KEY_SHOW_SETTING_CONTROL_PANEL, false,true);
        SPUtils.getInstance().put(SPConstants.SP_KEY_LOGIN_VALID,true,true);
        SPUtils.getInstance().put(SPConstants.SP_KEY_SHOW_SETTING_CONTROL_PANEL, false,true);
        SPUtils.getInstance().put(SPConstants.SP_KEY_PROJECT_COMPANY_CODE, "",true);
        SPUtils.getInstance().put(SPConstants.SP_KEY_SHOW_SETTING_WORK_MODEL, false,true);
        SPUtils.getInstance().put(SPConstants.SP_KEY_SHOW_SETTING_LOCAL_CHANGE,false,true);
        SPUtils.getInstance().put(SPConstants.SP_KEY_DEVICE_NUM_CHANGE,false,true);
        SPUtils.getInstance().put(SPConstants.SP_KEY_SHOW_SETTING_SERVER_CHANGE,false,true);
        SPUtils.getInstance().put(SPConstants.SP_KEY_USER_NAME, "",true);
    }
}
